function supportedBrowser(e) {
	//Older browsers are not supported
	if(!document.getElementById) return false;
	// Gecko: stop the browser from following the link.
	// This is good for so that there is no need for a
	// noscript section, as the link will followed if
	// there is no javascript.
	e.preventDefault();
	
	return true;
}

function getElement(e) {
	//Get the event object if IE
	if(!e) var e = window.event;
	
	// Grabs the element clicked
	// e.target is gecko based
	return (e.target) ? e.target : e.srcElement;
}

function getElementsByClassName(className) {
	var hasClassName = new RegExp("(?:^|\\s)" + className + "(?:$|\\s)");
	var allElements = document.getElementsByTagName("*");
	var results = [];

	var element;
	for (var i = 0; (element = allElements[i]) != null; i++) {
		var elementClass = element.className;
		if (elementClass && 
		      elementClass.indexOf(className) != -1 && 
		      hasClassName.test(elementClass)) {
			results.push(element);
		}
	}

	return results;
}

// This is an attempt at making a new window appear for preview
function editQuestion(e) {
	if(!supportedBrowser(e)) return true;
	
	element = getElement(e);

	url = element.attributes.getNamedItem("href").value;
	name = element.attributes.getNamedItem("name").value;

	window.open(url+"&min=1", name, "width=900,height=700,toolbar=yes,location=no,directories=no,menubar=no, scrollbars=yes");

	return false;
}

